﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace MT.CustomUserControl.Convert
{
    /// <summary>
    /// 年龄与BorderBrush转换器
    /// </summary>
    [ValueConversion(typeof(bool), typeof(SolidColorBrush))]
    public class BoolBrushConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                if ((bool)value)
                    return new SolidColorBrush(Colors.Green);
                else
                    return new SolidColorBrush(Colors.Gray);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
